package cc.aiee.core.kit;

import java.util.Date;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;

public class KitId {

	/**
	 * 返回时间戳
	 * @return yyyyMMddHHmmssSSS
	 * @author YangLong <br>
	 * 2020年11月9日
	 */
	public static String timestampId() {
		String timestamp = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
		return timestamp;
	}

	/**
	 * 生成时间戳的Id 加 4位随机小写字符
	 * <dl>
	 * <dt>参考:</dt>
	 * <dd>20200802171526162dsfx</dd>
	 * <dd>长度:21</dd>
	 * </dl>
	 * 
	 * @return
	 */
	public static String timeId() {
		String timestamp = timestampId();
		String randomString = RandomUtil.randomString(RandomUtil.BASE_CHAR, 4);

		String timeId = timestamp + randomString;
		return timeId;
	}
	public static String second() {
		String second = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
		return second;
	}
}
